<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>
<div class="setbg">
  <div class="search">
    <div class="search-title">查询条件</div>
    <div class="search-en-title">query criteria</div>
    <div class="search-body">
      <div class="search-item">
        <span>报告编号</span>
        <input type="text" id="searchReportNo"/>
      </div>
      <div class="search-comment">（不要输入编号中的‘/’和空格）</div>
      <div class="search-item">
        <span>验证码</span>
        <input id="captcha" type="text"/>
        <img id="checkCode" style="width: 20%;height: 100%; margin-left: 5px;"/>
      </div>
      <div class="search-comment">（请按照左侧图中内容输入数字或英文，英文不区分大小写。）</div>
      <div class="search-comment" style="color: red; display: none;font-size: 15px" id="comment_tips"></div>
    </div>

    <div class="search-footer">
      <button class="input-button" id="searchBtn">搜索</button>
      <span class="search-tip">
        (如果有疑问,请及时<span class="call-me">联系我们</span>)
      </span>
    </div>
  </div>
  <div class="search-result">
    <div class="search-result-head">
      <div class="search-title">查询结果</div>
      <div class="search-en-title">query result</div>
    </div>
    <div id="search-result-body" class="search-result-body" style="display: none">
      <div class="result-title">
        <div class="company-info" style="display: flex;flex-direction: column;align-items: center;">
          <span id="entrustingCompany"></span>
          <span id="entrustingProject"></span>
        </div>
        <div class="project-info" style="display: flex; justify-content: space-between;">
          <span>
            NO:
            <span id="reportNo"></span>
          </span>
          <span>
            年份季度:
            <span id="annualQuarter"></span>
          </span>
        </div>
      </div>
      <div class="result-body">
        <div class="info-items">
          <div class="items-title">项目概况</div>
          <div class="info-form">
            <div class="info-item">
              <span>项目名称</span>
              <span class="entrustingProject"></span>
            </div>
            <div class="info-item">
              <span>行业类别</span>
              <span id="industryType"></span>
            </div>
            <div class="info-item">
              <span>项目主业</span>
              <span class="entrustingCompany"></span>
            </div>
            <div class="info-item">
              <span>项目性质</span>
              <span id="projectNature"></span>
            </div>
            <div class="info-item" style="width: 100%;">
              <span>项目地址</span>
              <span id="projectAddress"></span>
            </div>
            <div class="info-item" style="width: 100%;">
              <span>项目简介</span>
              <span id="projectDescription"></span>
            </div>
          </div>
        </div>
        <div class="info-items">
          <div class="items-title">评测机构及评测项目组</div>
          <div class="info-form">
            <div class="info-item">
              <span>评测机构</span>
              <span id="evaluationCriterion"></span>
            </div>
            <div class="info-item">
              <span>机构负责人</span>
              <span id="organizationLeader"></span>
            </div>
            <div class="info-item">
              <span>技术负责人</span>
              <span id="technicalDirector"></span>
            </div>
            <div class="info-item">
              <span>过程过程控制人</span>
              <span id="processControlSupervisor"></span>
            </div>
            <div class="info-item">
              <span>项目评测组长</span>
              <span id="projectEvaluationLeader"></span>
            </div>
            <div class="info-item">
              <span>报告编制人</span>
              <span id="reportMaker"></span>
            </div>
            <div class="info-item">
              <span>报告审核人</span>
              <span id="reportVerifier"></span>
            </div>
            <div class="info-item">
              <span>项目安全评价人</span>
              <span id="projectSafetyEvaluator"></span>
            </div>
            <div class="info-item">
              <span>参与评价工作的注册安全工作师、技术专家</span>
              <span id="participant"></span>
            </div>
          </div>
        </div>
        <div class="info-items">
          <div class="items-title">评价活动主要信息</div>
          <div class="info-form">
            <div class="info-item">
              <span>签订合同时间</span>
              <span id="contractSignDate"></span>
            </div>
            <div class="info-item">
              <span>报告提交时间</span>
              <span id="reportCommitDate"></span>
            </div>
            <div class="info-item" style="width: 100%;">
              <span>安全评价类型</span>
              <span id="evaluationSafetyType"></span>
            </div>
            <div class="info-item" style="width: 100%;">
              <span>到现场开展评价活动人员</span>
              <span id="sceneEvaluationPerson"></span>
            </div>
            <div class="info-item" style="width: 100%;">
              <span>到现场开展评价活动时间</span>
              <span id="sceneEvaluationDate"></span>
            </div>
            <div class="info-item" style="width: 100%;">
              <span>评价机构认为需要公开的信息</span>
              <span id="otherOpenInfo"></span>
            </div>
            <div class="info-item" style="width: 100%;">
              <span>评价结论</span>
              <span id="evaluationConclusion"></span>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

<table align="center" border="1" style="border-collapse:collapse;" id="tableId"></table>

<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
  $(function () {
    // let BaseUrl = 'http://localhost:8080';
    let BaseUrl = 'http://www.faith-safety.com:8080/service/';
    let str = location.href; //取得整个地址栏
    let num = str.indexOf("?reportNo=")
    let reportNo = str.substr(num +10);
    let searchResult = {
      entrustingCompany: "测试公司",
      entrustingProject: "测试"
    };
    let currdatetime;
    let resultIdList = [
      "contractSignDate",
      "createBy",
      "createTime",
      "entrustingCompany",
      "entrustingProject",
      "evaluationConclusion",
      "evaluationCriterion",
      "evaluationSafetyType",
      "industryType",
      "isInvalid",
      "isQrcodeGen",
      "organizationLeader",
      "otherOpenInfo",
      "participant",
      "processControlSupervisor",
      "projectAddress",
      "projectDescription",
      "projectEvaluationLeader",
      "projectNature",
      "projectSafetyEvaluator",
      "reportCommitDate",
      "reportDate",
      "reportMaker",
      "reportNo",
      "reportType",
      "reportVerifier",
      "ruleId",
      "sceneEvaluationDate",
      "sceneEvaluationPerson",
      "sysOrgCode",
      "technicalDirector",
      "updateBy",
      "updateTime",
      "annualQuarter"
    ];

    getCheckCode();
    if (reportNo){
      $("#searchReportNo").val(reportNo);
      getData(true);
    }
    $('#searchBtn').click(function () {
      getData();
    })
    $('#checkCode').click(function () {
      getCheckCode();
    })

    // 页面赋值
    function pageAssignment() {
      for (let item of resultIdList) {
        if (document.getElementsByClassName(item)[0]) {
          document.getElementsByClassName(item)[0].innerText = searchResult[item];;
        }
        if (document.getElementById(item)) {
          document.getElementById(item).innerText = searchResult[item]
        }
      }
    }

    function getCheckCode() {
      currdatetime = new Date().getTime();
      $.ajax({
        type: "get",//请求方式
        url: BaseUrl + "/sys/randomImageStr/" + currdatetime,
        dataType: "jsonp",
        error: function (e) {
          console.log(e)
        },
        success: function (res) {
          console.log(res)
          $("#checkCode").attr("src", res.result.result);
        }
      });

    }

    function getData(isFirst) {
      let txt = $("#searchReportNo").val();
      let captcha = $("#captcha").val();
      $("#comment_tips")[0].style.display = "none";
      if (!txt && !isFirst){
        $("#comment_tips").html("请输入报告编号");
        $("#comment_tips")[0].style.display = "";
        return;
      }
      if (!captcha && !isFirst){
        $("#comment_tips").html("请输入验证码");
        $("#comment_tips")[0].style.display = "";
        return;
      }
      $.ajax({
        type: "get",//请求方式
        // url: 'https://www.faith-safety.com/reportVerfication/service/demo/rvQrcode/queryByIdStr?reportNo=' + txt,//请求的url
        url: BaseUrl + '/demo/rvQrcode/queryByIdStr?reportNo=' + txt + "&captcha=" + captcha + "&time=" + currdatetime,//请求的url
        dataType: "jsonp",
        error: function (e) {
          console.log(e)
        },
        success: function (res) {//响应成功执行的
          console.log(res.result)
          // document.getElementById('project_company').innerHTML = result.entrustingCompany;
          // document.getElementById('project_name').innerHTML = result.entrustingProject;
          if (res.result) {
            searchResult = res.result;
            pageAssignment()
            $("#search-result-body")[0].style.display = "";
          } else {
            $("#search-result-body")[0].style.display = "none";
            $("#comment_tips")[0].style.display = "";
            $("#comment_tips").html(res.message);
          }

          console.log(searchResult)


        }
      });
    }
  });
</script>

<style>
  body {
    background-color: #F5F5F5;
    overflow-y: auto;
    margin: 0;
    padding-bottom: 30px;
  }

  table {
    width: 70%;
  }

  p.title {
    font-family: "Times New Roman", Times, serif;
    font-weight: bold;
    font-size: xx-large;
    align-content: center;
  }

  label {
    display: inline-block;
    width: 100px;
    text-align: right;
  }

  input {
    width: 100%;
    height: 100%;
    background: #FFFFFF;
    border: 1px solid #EBEBEB;
    vertical-align: top;
    left: 500px;
  }

  .label {
    font-weight: bold;
    width: 100px;
  }

  .input-button {
    width: 37.5%;
    height: 10%;
    background: #2FADDE;
    color: #fff;
    outline: none;
    border: 0px;
    padding: 10px 5px;
    border-radius: 5px;
  }

  .setbg {
    background: url("backgroud.png");
    width: 100%;
    background-size: 100% auto;
    padding-top: 36%;
    height: 0px;
    position: relative;
  }

  .search {
    position: absolute;
    margin: 0 auto;
    float: top;
    width: 62.5%;
    height: 58%;
    top: 51%;
    left: 18.75%;
    background: #ffffff;
    padding-bottom: 4%;
  }

  .search-txt {
    font-family: Microsoft YaHei, serif;
  }

  .search-txt, .search-title {
    margin-top: 2%;
    text-align: center;
    font-weight: bold;
    color: #000000;
    font-size: 24px;
  }

  .search-txt, .search-en-title {
    text-align: center;
    font-size: 12px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #666666;
  }

  .search-comment {
    font-size: 12px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #999999;
  }

  .search-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 60%;
  }

  .search-item {
    margin-top: 15px;
    width: 52%;
    height: 16%;
    display: flex;
    justify-content: flex-start;
    align-items: center;
  }

  .search-item > span {
    margin-right: 10px;
    min-width: 80px;
    text-align: right;
  }

  .search-footer {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  .search-tip {
    color: #999999;
    font-size: 14px;
  }

  .search-tip .call-me {
    color: #2FADDE;
  }

  .search-result {

    box-sizing: border-box;
    margin: 80px auto 0;
    width: 62.5%;
    min-height: 500px;
  }

  .search-result-head {
    margin: 50px 0 30px;
  }

  .search-result-body {
    padding: 50px 100px;
    background-color: #fff;
    min-height: 500px;
  }

  .info-items {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
  }

  .info-items .items-title {
    font-size: 16px;
    font-weight: 600;
    color: #666;
  }

  .info-form {
    display: flex;
    flex-wrap: wrap;
  }

  .info-form .info-item {
    display: flex;
    flex-direction: column;
    width: 50%;
    margin-top: 15px;
  }

  .info-form .info-item > span:first-child {
    font-weight: 600;
  }
</style>
</body>
</html>
